﻿using System;

namespace Entities
{
    [Serializable]
    public class RouteDetail
    {
        private int routeID;
        private int stationID;
        private int stationNumber;
        public RouteDetail()
        { }
        public RouteDetail(int routeID, int stationID, int stationNumber)
        {
            this.routeID = routeID;
            this.stationID = stationID;
            this.stationNumber = stationNumber;
        }
        public int RouteID
        {
            get { return this.routeID; }
            set
            {
                if (value < 0)
                    throw new Exception("routeID not allow nullvalue.");
                this.routeID = value;
            }
        }
        public int StationID
        {
            get { return this.stationID; }
            set
            {
                if (value < 0)
                    throw new Exception("stationID not allow nullvalue.");
                this.stationID = value;
            }
        }
        public int StationNumber
        {
            get { return this.stationNumber; }
            set { this.stationNumber = value; }
        }
        public override string ToString()
        {
            return this.routeID + "; " + this.stationID + "; " + this.stationNumber + "; ";
        }
        public override bool Equals(Object obj)
        {
            RouteDetail me = (RouteDetail)obj;
            bool ret = this.RouteID.Equals(me.RouteID) && this.StationID.Equals(me.StationID);
            return ret;
        }
        public override int GetHashCode()
        {
            return this.RouteID.GetHashCode() + this.StationID.GetHashCode();
        }

    }
}